{{ define "main" }}
{{ $lan := index (split .URL "/") 1 }}
<div class="container">
    <div class="blog-detail">
        <div class="post_detail">
            <div class="is-child box">
                <div class="breadCrumb"><a href="\{{$lan}}\">{{ i18n "blog_title" }}/</a></div>
                <div class="blog-detail-header">
                    <h1>{{ .Title }}</h1>
                    <div class="blog-detail-prop">
                        <img src="/img/icon-date.svg">
                        <span class="article_right_date">{{ .Date.Format "2006-01-02" }}</span>
                        <img src="/img/icon-author.svg">
                        <span class="article_right_author">{{ .Params.author }}</span>
                        <img src="/img/icon-view.svg">
                        <span id="{{ .Permalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .LinkTitle }}">
                            <i class="leancloud-visitors-count"></i>                     
                        </span>
                    </div>
                    <div class="blog-detail-tags">
                        <img src="/img/icon-tag.svg">
                        {{ range .Params.tags }}
                        <a>{{ . }}</a>
                        {{ end }}
                    </div>
                </div>
                <div class="content blog-content">
                    {{ .Content }}
                </div>
            </div>
            <div class="box" style="margin-top:15px;">
                <div style="font-size:14px;color:gray"><strong>{{ i18n "blog_declare" }}</strong>{{ i18n "blog_declare_content" }}</div>
            </div>
            <div class="post-comment">
                <!-- 加入评论功能 -->
                {{ partial "comments.html" . }}
            </div>
        </div>
    </div>
</div>
<script>
    $(function (){
        var query = new AV.Query('Counter');
        query.equalTo('url', decodeURIComponent('{{.Permalink | relURL}}'));
        query.find().then(function (data) {
            if(data.length && (data[0].attributes.author === 'openGauss')){
                var counter = AV.Object.createWithoutData('Counter', data[0].id);
                counter.set('author', '{{.Params.author}}');
                counter.save();
            }
        })
    })
</script>


{{ end }}
